<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/jquery.easyui.min.js"/>"></script>
<script type="text/javascript" src="<c:url value="js/jquery-easyui-1.5.4.2/locale/easyui-lang-zh_CN.js"/>"></script>
<link id="theme" rel="stylesheet" type="text/css"  href="<c:url value="js/jquery-easyui-1.5.4.2/themes/ui-cupertino/easyui.css"/>"/>
<link  rel="stylesheet" type="text/css" href="<c:url value="js/jquery-easyui-1.5.4.2/themes/icon.css"/>"/>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>增加单选信息</title>
</head>

<body>
<style>
	.line{
		margin:5px 20px;
	}
	.div{
		float:left;
		margin:0px 50px 0px 10px;
	}
	
</style>
<script type="text/javascript">
	$(function(){
		
		$(".multiple2_back").linkbutton({
			onClick:function(){
				$(".multiple2_back_").panel({
					href:"to_multiple2?questionType="+"多选"
					
				})
			}
		})

		//表格点击事件
		$('#multiple2_tiku').textbox({
			icons: [{
				iconCls:'icon-add',
				handler: function(e){
					$("#multiple2_insert_win").dialog("open");
					$("#hhy_multiple2_insert_tiku").datagrid({onDblClickRow:function(index,row){
						var kssj_quId = row.quId;
						var kssj_quName= row.quName;
						$("#multiple2_tiku").textbox("setValue",kssj_quId);
						$("#quName1").textbox("setValue",kssj_quName);
						$("#multiple2_insert_win").dialog("close");

					}});

				}
			}]
		})
		
		//添加
		$("#multiple2_insert_button").linkbutton({onClick:function(){
			if ($('#multiple2_tiku').textbox("getText")=='' || $('#quName1').textbox("getText")=='') {   
				$.messager.confirm('提示','带*的为必填项',function(r){    
				}); 
			}else{
			$("#multiple2_insert_form").form({
				url:'multiple2_insert',
				onSubmit:function(insert){
					insert["questionType.questionType"] = $("#questionType").val();
					insert["questionType.quesDifficulty"] = $("#quesDifficulty").val();
					insert["questionType.numberOptions"] = $("#numberOptions").val();
					insert["questionType.quesExam"] = $("#quesExam").val();
					insert["questionType.quesExercise"] = $("#quesExercise").val();
					insert["questionType.quesContent"] = $("#quesContent").val();
					insert["questionType.optionsA"] = $("#optionsA").textbox("getText");
					insert["questionType.optionsB"] = $("#optionsB").textbox("getText");
					insert["questionType.optionsC"] = $("#optionsC").textbox("getText");
					insert["questionType.optionsD"] = $("#optionsD").textbox("getText");
					var quesAnswer;
					if($("#quesAnswerASelected").is(":checked")){
						quesAnswer = $("#quesAnswerASelected").val();
					}
					if($("#quesAnswerBSelected").is(":checked")){
						quesAnswer = $("#quesAnswerBSelected").val();
					}
					if($("#quesAnswerCSelected").is(":checked")){
						quesAnswer = $("#quesAnswerCSelected").val();
					}
					if($("#quesAnswerDSelected").is(":checked")){
						quesAnswer = $("#quesAnswerDSelected").val();
					}
					insert["questionType.quesAnswer"] = quesAnswer;
	
					insert["questionBank.quId"] = $("#multiple2_tiku").textbox("getText");
					insert["questionBank.quName"] = $("#quName1").textbox("getText");
					
				},
				success:function(v){
					v = eval("("+v+")");
					if(v.success){
						$.messager.alert('恭喜', '添加成功');
						$(".multiple2_back_").panel({
							href:"to_multiple2?questionType="+"多选"
							
						})
					}else{
						$.messager.alert('错误', '对不起，操作失败，原因：'+v.message);
					}
				}
			}).submit();
			}
		}});
		
		
		
	});		
</script>
<div class="easyui-panel multiple2_back_" data-options="fit:true,border:false">
	<a href="#" class="easyui-linkbutton multiple2_back"  data-options="iconCls:'icon-back',plain:true,text:'返回'"></a><!-- 
	<a href="#" class="easyui-linkbutton"  data-options="iconCls:'icon-filesave',plain:true,text:'保存'"></a> -->
	<form id="multiple2_insert_form" action="post"></form>
		<div class="div">
			<div style="border-bottom:2px solid blue;width:400px;">题目信息</div>
				<div class="line">
					<input class="easyui-textbox" id="testQuestions" name="testQuestions" data-options="label:'试题id',width:350,height:25,labelWidth:130"/>
				</div>
				<div class="line">
					<select class="easyui-combobox" name="questionType" id="questionType" data-options="label:'题型/难度',width:235,height:25,panelHeight:'auto',labelWidth:130,editable:false">
					<option value="多选">多选</option>
					</select>
					<select class="easyui-combobox" name="quesDifficulty" id="quesDifficulty" data-options="width:110,height:25,panelHeight:'auto',labelWidth:130,editable:false">
					<option value="高级">高级</option>
					<option value="中级">中级</option>
					<option value="低级">低级</option>
					</select>
				</div>
				<div class="line">
					<input class="easyui-textbox" name="quId" id="multiple2_tiku" data-options="label:'*题库',width:235,height:25,labelWidth:130,editable:false"/>
					<input class="easyui-textbox" id="quName1" name="quName" data-options="width:110,height:25,editable:false"/>
				</div>
				<div class="line">
					<select class="easyui-combobox" name="numberOptions" id="numberOptions" data-options="label:'答案数',width:350,height:25,panelHeight:'auto',labelWidth:130,editable:false">
					<option value="2">2</option>
					<option value="3">3</option>
					<option value="4">4</option>
					</select>
				</div>
				
			</div>
			<div class="div">
				<div style="border-bottom:2px solid blue;width:400px;">概要</div>
				
				<div class="line">
					<select id="quesExam" class="easyui-combobox" name="quesExam" data-options="label:'用于考试',width:350,height:25,panelHeight:'auto',labelWidth:130,editable:false">
						<option value="是">是</option>
						<option value="否">否</option>
					</select>
					
				</div>
				<div class="line">
					<select id="quesExercise" class="easyui-combobox" name="quesExercise" data-options="label:'用于练习',width:350,height:25,panelHeight:'auto',labelWidth:130,editable:false">
						<option value="是">是</option>
						<option value="否">否</option>
					</select>
					
				</div>
			</div>
			<div class="div">
				<div style="border-bottom:2px solid blue;width:650px;margin-bottom:5px;">题目内容</div>
				<div class="">
					<textarea id="quesContent" name="quesContent" rows="5" cols="90"></textarea>
				</div>
			</div>
			<div class="div">
				<div style="border-bottom:2px solid blue;width:280px;">答案</div>
				<div class="line">
					A：<input class="easyui-textbox" name="optionsA" id="optionsA" data-options="width:220,height:25"/></br>
				</div>
				<div class="line">
					B：<input class="easyui-textbox" name="optionsB" id="optionsB" data-options="width:220,height:25"/></br>
				</div>
				<div class="line">
					C：<input class="easyui-textbox" name="optionsC" id="optionsC" data-options="width:220,height:25"/></br>
				</div>
				<div class="line">
					D：<input class="easyui-textbox" name="optionsD" id="optionsD" data-options="width:220,height:25"/></br>
				</div>
				答案
				<div class="line">
					A<input type="radio"  id="quesAnswerASelected" name="quesAnswer" value="A" style="margin-left: 30px"/>
				</div>
				<div class="line">
					B<input type="radio"  id="quesAnswerBSelected" name="quesAnswer" value="B" style="margin-left: 30px"/>
				</div>
				<div class="line">
					C<input type="radio"  id="quesAnswerCSelected" name="quesAnswer" value="C" style="margin-left: 30px"/>
				</div>
				<div class="line">
					D<input type="radio"  id="quesAnswerDSelected" name="quesAnswer" value="D" style="margin-left: 30px"/>
				</div>
			
			</div>
			
			<div class="div">
				<div class="line">
					<a id="multiple2_insert_button" class="easyui-linkbutton" data-options="width:80,height:30,text:'添加'"></a>
				</div>
			</div>
			
			<div class="easyui-dialog" id="multiple2_insert_win" data-options="width:550,height:400,title:'清单查找-题库',
				modal:true,
				closed:true,
				buttons:[{
					text:'确定',
					iconCls:'icon-ok',
					handler:function(){
						$('#multiple2_close').form({
							onSubmit:function(){
								var row = $('#hhy_multiple2_insert_tiku').datagrid('getSelected');
									 	var kssj_quId = row.quId;
										var kssj_quName= row.quName;
										$('#multiple2_tiku').textbox('setValue',kssj_quId);
										$('#quName1').textbox('setValue',kssj_quName);
								
							},success:function(v){
								$('#multiple2_insert_win').dialog('close');
							}
						}).submit();
					}
				},{
					text:'取消',
					iconCls:'icon-clear',
					handler:function(){
						$('#multiple2_insert_win').dialog('close');
					}
				}]">
				<form action="" method="post" id="multiple2_close">
					<div class="line">
						<input class="easyui-textbox" name="quId" data-options="label:'题库编号',width:300,field:'quId'"/>
						<a class="easyui-linkbutton" name="vague" data-options="text:'模糊查询',width:100" style="float:right"/>
					</div>
					<div class="line">
						<input class="easyui-textbox" name="quName" data-options="label:'题库名称',width:300,field:'quName'"/>
						<a class="easyui-linkbutton" name="vague" data-options="text:'搜索',width:100" style="float:right"/>
					</div>
					<div class="line">
						<table id="hhy_multiple2_insert_tiku" style="width:100%;height:220px;" class="easyui-datagrid" data-options="
							url:'findAll_questionBank_page',
							method:'get',
							pagination:true,
							pageSize:1,
							pageList:[1,2,3,4,5],
							autoRowHeight:true,
							nowrap:false,
							rownumbers:true,
							singleSelect:true,
							striped:true
							
							">
							<thead>
							  <tr>
								<th data-options="align:'center',field:'quId',width:100">题库编号</th>
								<th data-options="align:'center',field:'quName',width:120">题库名称</th>
							  </tr>
							</thead>
							<tbody>
								
							</tbody>
						</table>
					</div>
				</form>
			</div>
</div>
</body>
</html>